{% sw_extends '@Storefront/storefront/base.html.twig' %}

{% block base_content %}
    {% block page_account_profile_reset_password %}
        <div class="account-reset-password row justify-content-md-center">
            {% block page_account_profile_reset_password_inner %}
                <div class="col-md-8 col-lg-6">
                    {% block page_account_profile_reset_password_form %}
                        <form method="post"
                              class="account-reset-password-form card"
                              action="{{ path('frontend.account.recover.password.reset') }}"
                              data-form-handler="true">
                            {% block page_account_profile_reset_password_title %}
                                <h1 class="card-title">
                                    {{ 'account.profileRecoverPasswordTitle'|trans }}
                                </h1>
                            {% endblock %}

                            {% block page_account_profile_reset_password_container %}
                                <div class="card-body">
                                    {% block page_account_profile_reset_password_new %}

                                        {% set passwordFieldDescription = '' %}

                                        {% if config('core.loginRegistration.passwordMinLength') != 0 %}
                                            {% set passwordFieldDescription = 'account.personalPasswordDescription'|trans({
                                                '%minLength%': config('core.loginRegistration.passwordMinLength')
                                            })|sw_sanitize %}
                                        {% endif %}

                                        {% sw_include '@Storefront/storefront/component/form/form-input.html.twig' with {
                                            type: 'password',
                                            label: 'account.profilePasswordCreateNew'|trans|sw_sanitize,
                                            id: 'newPassword',
                                            name: 'password[newPassword]',
                                            description: passwordFieldDescription,
                                            autocomplete: 'new-password',
                                            violationPath: '/newPassword',
                                            validationRules: 'required,minLength',
                                            minlength: config('core.loginRegistration.passwordMinLength'),
                                        } %}
                                    {% endblock %}

                                    {% block page_account_profile_reset_password_confirm %}
                                        {% sw_include '@Storefront/storefront/component/form/form-input.html.twig' with {
                                            type: 'password',
                                            label: 'account.personalPasswordConfirmationLabel'|trans|sw_sanitize,
                                            id: 'newPasswordConfirmation',
                                            name: 'password[newPasswordConfirm]',
                                            autocomplete: 'new-password',
                                            violationPath: '/newPasswordConfirm',
                                            validationRules: 'required,confirmation',
                                        } %}
                                    {% endblock %}

                                    {% block page_account_profile_reset_password_hash_input %}
                                        <input type="hidden"
                                               id="passwordHash"
                                               value="{{ page.getHash }}"
                                               name="password[hash]"
                                               required="required">
                                    {% endblock %}

                                    {% block page_account_profile_reset_password_action_buttons %}
                                        <div class="account-reset-password-form-actions">
                                            {% block page_account_profile_reset_password_action_button_send %}
                                                <button type="submit"
                                                        class="account-reset-password-submit btn btn-primary"
                                                        title="{{ 'account.profileChangePassword'|trans }}">
                                                    {{ 'account.profileChangePassword'|trans }}
                                                </button>
                                            {% endblock %}
                                        </div>
                                    {% endblock %}
                                </div>
                            {% endblock %}
                        </form>
                    {% endblock %}
                </div>
            {% endblock %}
        </div>
    {% endblock %}
{% endblock %}
